package com.xbts.system.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.xbts.system.domain.SeiMaterial;
import com.xbts.system.domain.SeiTask;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 素材Mapper接口
 * 
 * @author xbts
 * @date 2023-08-24
 */
public interface SeiMaterialMapper extends BaseMapper<SeiMaterial> {


    @Select("SELECT m.*, m2.name as parent_name, " +
            "m3.name as grandparent_name, " +
            "u.nick_name as affiliation_name " +

            "FROM sei_material m " +
            "LEFT JOIN sei_material m2 on m.parent_id = m2.material_id " +
            "LEFT JOIN sei_material m3 on m.grandparent = m3.material_id " +
            "LEFT JOIN sys_user u on m.material_affiliation = u.user_id " +
            " ${ew.customSqlSegment}")
    List<SeiMaterial> searchMaterialList(@Param(Constants.WRAPPER) QueryWrapper<SeiMaterial> queryWrapper);
}
